package com.zhx.common.chat.service;

import com.zhx.common.chat.domain.dto.MsgReadInfoDTO;
import com.zhx.common.chat.domain.entity.Message;
import com.zhx.common.chat.domain.vo.request.*;
import com.zhx.common.chat.domain.vo.request.member.MemberReq;
import com.zhx.common.chat.domain.vo.response.ChatMemberStatisticResp;
import com.zhx.common.chat.domain.vo.response.ChatMessageReadResp;
import com.zhx.common.chat.domain.vo.response.ChatMessageResp;
import com.zhx.common.common.domain.vo.resp.CursorPageBaseResp;
import com.zhx.common.websocket.domain.vo.resp.ChatMemberResp;

import java.util.Collection;
import java.util.List;

public interface ChatService {

    /**
     * 发送消息
     * @param request
     * @param uid
     * @return
     */
    Long sendMsg(ChatMessageReq request, Long uid);

    /**
     * 根据消息获取前端展示的物料
     * @param msgId
     * @param uid
     * @return
     */
    ChatMessageResp getMsgResp(Long msgId, Long uid);

    /**
     * 根据消息获取前端展示的物料
     * @param message
     * @param receiveUid
     * @return
     */
    ChatMessageResp getMsgResp(Message message, Long receiveUid);


    /**
     * 统计在线和不在线的人数
     * @return
     */
    ChatMemberStatisticResp getMemberStatistic();

    /**
     * 分页查询消息记录
     * @param req
     * @param uid
     * @return
     */
    CursorPageBaseResp<ChatMessageResp> getMsgPage(ChatMessagePageReq req, Long uid);

    /**
     * 撤回消息
     * @param uid
     * @param req
     */
    void recallMsg(Long uid, ChatMessageBaseReq req);

    /**
     * 消息标记
     * @param uid
     * @param request
     */
    void setMsgMark(Long uid, ChatMessageMarkReq request);


    /**
     * 消息已读未读列表
     * @param uid
     * @param request
     * @return
     */
    CursorPageBaseResp<ChatMessageReadResp> getReadPage(Long uid, ChatMessageReadReq request);

    /**
     * 获取消息已读未读总数
     * @param uid
     * @param request
     * @return
     */
    Collection<MsgReadInfoDTO> getMsgReadInfo(Long uid, ChatMessageReadInfoReq request);

    /**
     * 消息阅读上报
     * @param uid
     * @param request
     */
    void msgRead(Long uid, ChatMessageMemberReq request);

    /**
     * 获取群成员列表
     * @param request
     * @return
     */
    CursorPageBaseResp<ChatMemberResp> getMemberPage(MemberReq request, List<Long> memberUidList);
}
